<template>
	<view class="p30">
		<u--textarea v-model="value2" height="200"  maxlength="300" placeholder="请输入内容" count ></u--textarea>
		
		<view class="btn" @click="handleRelease">
			发布
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				value2: ''
			}
		},
		methods: {
			async handleRelease() {
				if(!this.value2) return this.$msg.error('请输入内容')
				
				try {
					await this.$api.newAnnouncementApi({
						noticeContent: this.value2,
						status: 0,
						noticeType: 2,
						noticeTitle: '小程序公告'
					})
					
					this.$msg.success('发布成功!')
					
					setTimeout(() => {
						uni.navigateBack()
					}, 1000)
				} catch (error) {
					//TODO handle the exception
				}
			}
		}
	}
</script>

<style scoped lang="scss">
.content {
	border: 1px solid #C6C6C6;
	border-radius: 10rpx;
	background-color: #FFF;
	padding: 20rpx 10rpx;
}

.btn {
	height: 50rpx;
	width: 120rpx;
	text-align: center;
	line-height: 50rpx;
	background-color: #EAF5FF;
	color: #92C5F5;
	border-radius: 10rpx;
	border: 1rpx solid #92C5F5;
	margin: 40rpx auto;
}
</style>
